package com.zhuguowei.umdemo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

import com.umeng.socialize.bean.SHARE_MEDIA;
import com.zhuguowei.umdemo.umeng.ShareUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class MainActivity extends AppCompatActivity {

    @BindView(R.id.share_tv_weixin)
    TextView mShareTvWeixin;
    @BindView(R.id.share_tv_wechat_circle)
    TextView mShareTvWechatmoments;
    @BindView(R.id.share_tv_qq)
    TextView mShareTvQq;
    @BindView(R.id.share_tv_qzone)
    TextView mShareTvQzone;
    @BindView(R.id.share_tv_sinaweibo)
    TextView mShareTvSinaweibo;

    private String shareTitle = "这是主标题";
    private String shareText = "(这是副标题，也是内容描述详情)(这是副标题，也是内容描述详情)(这是副标题，也是内容描述详情)(这是副标题，也是内容描述详情)(这是副标题，也是内容描述详情)(这是副标题，也是内容描述详情)";
    private String url = "https://gitee.com/avail0/UmDemo";
    private ShareUtils mUmengShareUtils;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_share);
        ButterKnife.bind(this);

        mUmengShareUtils = new ShareUtils(this);
    }

    @OnClick({R.id.share_tv_weixin, R.id.share_tv_wechat_circle, R.id.share_tv_qq, R.id.share_tv_qzone, R.id.share_tv_sinaweibo})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.share_tv_weixin:
                mUmengShareUtils.share2App(SHARE_MEDIA.WEIXIN,url,"微信分享-"+shareTitle,shareText).share();
                break;
            case R.id.share_tv_wechat_circle:
                mUmengShareUtils.share2App(SHARE_MEDIA.WEIXIN_CIRCLE,url,"微信朋友圈分享-"+shareTitle,shareText).share();
                break;
            case R.id.share_tv_qq:
                mUmengShareUtils.share2App(SHARE_MEDIA.QQ,url,"QQ分享-"+shareTitle,shareText).share();
                break;
            case R.id.share_tv_qzone:
                mUmengShareUtils.share2App(SHARE_MEDIA.QZONE,url,"QQ空间分享-"+shareTitle,shareText).share();
                break;
            case R.id.share_tv_sinaweibo:
                mUmengShareUtils.share2App(SHARE_MEDIA.SINA,url,"微博分享-"+shareTitle,shareText).share();
                break;
        }
    }
}
